home *** CD-ROM | disk | FTP | other *** search
/ Windows Game Programming for Dummies (2nd Edition) / WinGamProgFD.iso / mac / DirectX SDK / DXSDK / include / d3dx8tex.h < prev    next >
C/C++ Source or Header  |  2001-10-08  |  56KB  |  1,593 lines

  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. //  Copyright (C) Microsoft Corporation.  All Rights Reserved.
  4. //
  5. //  File:       d3dx8tex.h
  6. //  Content:    D3DX texturing APIs
  7. //
  8. //////////////////////////////////////////////////////////////////////////////
  9.  
  10. #include "d3dx8.h"
  11.  
  12. #ifndef __D3DX8TEX_H__
  13. #define __D3DX8TEX_H__
  14.  
  15.  
  16. //----------------------------------------------------------------------------
  17. // D3DX_FILTER flags:
  18. // ------------------
  19. //
  20. // A valid filter must contain one of these values:
  21. //
  22. //  D3DX_FILTER_NONE
  23. //      No scaling or filtering will take place.  Pixels outside the bounds
  24. //      of the source image are assumed to be transparent black.
  25. //  D3DX_FILTER_POINT
  26. //      Each destination pixel is computed by sampling the nearest pixel
  27. //      from the source image.
  28. //  D3DX_FILTER_LINEAR
  29. //      Each destination pixel is computed by linearly interpolating between
  30. //      the nearest pixels in the source image.  This filter works best 
  31. //      when the scale on each axis is less than 2.
  32. //  D3DX_FILTER_TRIANGLE
  33. //      Every pixel in the source image contributes equally to the
  34. //      destination image.  This is the slowest of all the filters.
  35. //  D3DX_FILTER_BOX
  36. //      Each pixel is computed by averaging a 2x2(x2) box pixels from 
  37. //      the source image. Only works when the dimensions of the 
  38. //      destination are half those of the source. (as with mip maps)
  39. //
  40. // And can be OR'd with any of these optional flags:
  41. //
  42. //  D3DX_FILTER_MIRROR_U
  43. //      Indicates that pixels off the edge of the texture on the U-axis
  44. //      should be mirrored, not wraped.
  45. //  D3DX_FILTER_MIRROR_V
  46. //      Indicates that pixels off the edge of the texture on the V-axis
  47. //      should be mirrored, not wraped.
  48. //  D3DX_FILTER_MIRROR_W
  49. //      Indicates that pixels off the edge of the texture on the W-axis
  50. //      should be mirrored, not wraped.
  51. //  D3DX_FILTER_MIRROR
  52. //      Same as specifying D3DX_FILTER_MIRROR_U | D3DX_FILTER_MIRROR_V |
  53. //      D3DX_FILTER_MIRROR_V
  54. //  D3DX_FILTER_DITHER
  55. //      Dithers the resulting image.
  56. //
  57. //----------------------------------------------------------------------------
  58.  
  59. #define D3DX_FILTER_NONE            (1 << 0)
  60. #define D3DX_FILTER_POINT           (2 << 0)
  61. #define D3DX_FILTER_LINEAR          (3 << 0)
  62. #define D3DX_FILTER_TRIANGLE        (4 << 0)
  63. #define D3DX_FILTER_BOX             (5 << 0)
  64.  
  65. #define D3DX_FILTER_MIRROR_U        (1 << 16)
  66. #define D3DX_FILTER_MIRROR_V        (2 << 16)
  67. #define D3DX_FILTER_MIRROR_W        (4 << 16)
  68. #define D3DX_FILTER_MIRROR          (7 << 16)
  69. #define D3DX_FILTER_DITHER          (8 << 16)
  70.  
  71.  
  72. //----------------------------------------------------------------------------
  73. // D3DX_NORMALMAP flags:
  74. // ---------------------
  75. // These flags are used to control how D3DXComputeNormalMap generates normal
  76. // maps.  Any number of these flags may be OR'd together in any combination.
  77. //
  78. //  D3DX_NORMALMAP_MIRROR_U
  79. //      Indicates that pixels off the edge of the texture on the U-axis
  80. //      should be mirrored, not wraped.
  81. //  D3DX_NORMALMAP_MIRROR_V
  82. //      Indicates that pixels off the edge of the texture on the V-axis
  83. //      should be mirrored, not wraped.
  84. //  D3DX_NORMALMAP_MIRROR
  85. //      Same as specifying D3DX_NORMALMAP_MIRROR_U | D3DX_NORMALMAP_MIRROR_V
  86. //  D3DX_NORMALMAP_INVERTSIGN
  87. //      Inverts the direction of each normal 
  88. //  D3DX_NORMALMAP_COMPUTE_OCCLUSION
  89. //      Compute the per pixel Occlusion term and encodes it into the alpha.
  90. //      An Alpha of 1 means that the pixel is not obscured in anyway, and
  91. //      an alpha of 0 would mean that the pixel is completly obscured.
  92. //
  93. //----------------------------------------------------------------------------
  94.  
  95. //----------------------------------------------------------------------------
  96.  
  97. #define D3DX_NORMALMAP_MIRROR_U     (1 << 16)
  98. #define D3DX_NORMALMAP_MIRROR_V     (2 << 16)
  99. #define D3DX_NORMALMAP_MIRROR       (3 << 16)
  100. #define D3DX_NORMALMAP_INVERTSIGN   (8 << 16)
  101. #define D3DX_NORMALMAP_COMPUTE_OCCLUSION (16 << 16)
  102.  
  103.  
  104.  
  105.  
  106. //----------------------------------------------------------------------------
  107. // D3DX_CHANNEL flags:
  108. // -------------------
  109. // These flags are used by functions which operate on or more channels
  110. // in a texture.
  111. //
  112. // D3DX_CHANNEL_RED
  113. //     Indicates the red channel should be used
  114. // D3DX_CHANNEL_BLUE
  115. //     Indicates the blue channel should be used
  116. // D3DX_CHANNEL_GREEN
  117. //     Indicates the green channel should be used
  118. // D3DX_CHANNEL_ALPHA
  119. //     Indicates the alpha channel should be used
  120. // D3DX_CHANNEL_LUMINANCE
  121. //     Indicates the luminaces of the red green and blue channels should be 
  122. //     used.
  123. //
  124. //----------------------------------------------------------------------------
  125.  
  126. #define D3DX_CHANNEL_RED            (1 << 0)
  127. #define D3DX_CHANNEL_BLUE           (1 << 1)
  128. #define D3DX_CHANNEL_GREEN          (1 << 2)
  129. #define D3DX_CHANNEL_ALPHA          (1 << 3)
  130. #define D3DX_CHANNEL_LUMINANCE      (1 << 4)
  131.  
  132.  
  133.  
  134.  
  135. //----------------------------------------------------------------------------
  136. // D3DXIMAGE_FILEFORMAT:
  137. // ---------------------
  138. // This enum is used to describe supported image file formats.
  139. //
  140. //----------------------------------------------------------------------------
  141.  
  142. typedef enum _D3DXIMAGE_FILEFORMAT
  143. {
  144.     D3DXIFF_BMP         = 0,
  145.     D3DXIFF_JPG         = 1,
  146.     D3DXIFF_TGA         = 2,
  147.     D3DXIFF_PNG         = 3,
  148.     D3DXIFF_DDS         = 4,
  149.     D3DXIFF_PPM         = 5,
  150.     D3DXIFF_DIB         = 6,
  151.     D3DXIFF_FORCE_DWORD = 0x7fffffff
  152.  
  153. } D3DXIMAGE_FILEFORMAT;
  154.  
  155.  
  156. //----------------------------------------------------------------------------
  157. // LPD3DXFILL2D and LPD3DXFILL3D:
  158. // ------------------------------
  159. // Function types used by the texture fill functions.
  160. //
  161. // Parameters:
  162. //  pOut
  163. //      Pointer to a vector which the function uses to return its result.
  164. //      X,Y,Z,W will be mapped to R,G,B,A respectivly. 
  165. //  pTexCoord
  166. //      Pointer to a vector containing the coordinates of the texel currently 
  167. //      being evaluated.  Textures and VolumeTexture texcoord components 
  168. //      range from 0 to 1. CubeTexture texcoord component range from -1 to 1.
  169. //  pTexelSize
  170. //      Pointer to a vector containing the dimensions of the current texel.
  171. //  pData
  172. //      Pointer to user data.
  173. //
  174. //----------------------------------------------------------------------------
  175.  
  176. typedef VOID (*LPD3DXFILL2D)(D3DXVECTOR4 *pOut, D3DXVECTOR2 *pTexCoord, D3DXVECTOR2 *pTexelSize, LPVOID pData);
  177. typedef VOID (*LPD3DXFILL3D)(D3DXVECTOR4 *pOut, D3DXVECTOR3 *pTexCoord, D3DXVECTOR3 *pTexelSize, LPVOID pData);
  178.  
  179.  
  180.  
  181. //----------------------------------------------------------------------------
  182. // D3DXIMAGE_INFO:
  183. // ---------------
  184. // This structure is used to return a rough description of what the
  185. // the original contents of an image file looked like.
  186. // 
  187. //  Width
  188. //      Width of original image in pixels
  189. //  Height
  190. //      Height of original image in pixels
  191. //  Depth
  192. //      Depth of original image in pixels
  193. //  MipLevels
  194. //      Number of mip levels in original image
  195. //  Format
  196. //      D3D format which most closely describes the data in original image
  197. //  ResourceType
  198. //      D3DRESOURCETYPE representing the type of texture stored in the file.
  199. //      D3DRTYPE_TEXTURE, D3DRTYPE_VOLUMETEXTURE, or D3DRTYPE_CUBETEXTURE.
  200. //  ImageFileFormat
  201. //      D3DXIMAGE_FILEFORMAT representing the format of the image file.
  202. //
  203. //----------------------------------------------------------------------------
  204.  
  205. typedef struct _D3DXIMAGE_INFO
  206. {
  207.     UINT                    Width;
  208.     UINT                    Height;
  209.     UINT                    Depth;
  210.     UINT                    MipLevels;
  211.     D3DFORMAT               Format;
  212.     D3DRESOURCETYPE         ResourceType;
  213.     D3DXIMAGE_FILEFORMAT    ImageFileFormat;
  214.  
  215. } D3DXIMAGE_INFO;
  216.  
  217.  
  218.  
  219.  
  220.  
  221. #ifdef __cplusplus
  222. extern "C" {
  223. #endif //__cplusplus
  224.  
  225.  
  226.  
  227. //////////////////////////////////////////////////////////////////////////////
  228. // Image File APIs ///////////////////////////////////////////////////////////
  229. //////////////////////////////////////////////////////////////////////////////
  230. ;
  231. //----------------------------------------------------------------------------
  232. // GetImageInfoFromFile/Resource:
  233. // ------------------------------
  234. // Fills in a D3DXIMAGE_INFO struct with information about an image file.
  235. //
  236. // Parameters:
  237. //  pSrcFile
  238. //      File name of the source image.
  239. //  pSrcModule
  240. //      Module where resource is located, or NULL for module associated
  241. //      with image the os used to create the current process.
  242. //  pSrcResource
  243. //      Resource name
  244. //  pSrcData
  245. //      Pointer to file in memory.
  246. //  SrcDataSize
  247. //      Size in bytes of file in memory.
  248. //  pSrcInfo
  249. //      Pointer to a D3DXIMAGE_INFO structure to be filled in with the 
  250. //      description of the data in the source image file.
  251. //
  252. //----------------------------------------------------------------------------
  253.  
  254. HRESULT WINAPI
  255.     D3DXGetImageInfoFromFileA(
  256.         LPCSTR                    pSrcFile,
  257.         D3DXIMAGE_INFO*           pSrcInfo);
  258.  
  259. HRESULT WINAPI
  260.     D3DXGetImageInfoFromFileW(
  261.         LPCWSTR                   pSrcFile,
  262.         D3DXIMAGE_INFO*           pSrcInfo);
  263.  
  264. #ifdef UNICODE
  265. #define D3DXGetImageInfoFromFile D3DXGetImageInfoFromFileW
  266. #else
  267. #define D3DXGetImageInfoFromFile D3DXGetImageInfoFromFileA
  268. #endif
  269.  
  270.  
  271. HRESULT WINAPI
  272.     D3DXGetImageInfoFromResourceA(
  273.         HMODULE                   hSrcModule,
  274.         LPCSTR                    pSrcResource,
  275.         D3DXIMAGE_INFO*           pSrcInfo);
  276.  
  277. HRESULT WINAPI
  278.     D3DXGetImageInfoFromResourceW(
  279.         HMODULE                   hSrcModule,
  280.         LPCWSTR                   pSrcResource,
  281.         D3DXIMAGE_INFO*           pSrcInfo);
  282.  
  283. #ifdef UNICODE
  284. #define D3DXGetImageInfoFromResource D3DXGetImageInfoFromResourceW
  285. #else
  286. #define D3DXGetImageInfoFromResource D3DXGetImageInfoFromResourceA
  287. #endif
  288.  
  289.  
  290. HRESULT WINAPI
  291.     D3DXGetImageInfoFromFileInMemory(
  292.         LPCVOID                   pSrcData,
  293.         UINT                      SrcDataSize,
  294.         D3DXIMAGE_INFO*           pSrcInfo);
  295.  
  296.  
  297.  
  298.  
  299. //////////////////////////////////////////////////////////////////////////////
  300. // Load/Save Surface APIs ////////////////////////////////////////////////////
  301. //////////////////////////////////////////////////////////////////////////////
  302.  
  303. //----------------------------------------------------------------------------
  304. // D3DXLoadSurfaceFromFile/Resource:
  305. // ---------------------------------
  306. // Load surface from a file or resource
  307. //
  308. // Parameters:
  309. //  pDestSurface
  310. //      Destination surface, which will receive the image.
  311. //  pDestPalette
  312. //      Destination palette of 256 colors, or NULL
  313. //  pDestRect
  314. //      Destination rectangle, or NULL for entire surface
  315. //  pSrcFile
  316. //      File name of the source image.
  317. //  pSrcModule
  318. //      Module where resource is located, or NULL for module associated
  319. //      with image the os used to create the current process.
  320. //  pSrcResource
  321. //      Resource name
  322. //  pSrcData
  323. //      Pointer to file in memory.
  324. //  SrcDataSize
  325. //      Size in bytes of file in memory.
  326. //  pSrcRect
  327. //      Source rectangle, or NULL for entire image
  328. //  Filter
  329. //      D3DX_FILTER flags controlling how the image is filtered.
  330. //      Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE.
  331. //  ColorKey
  332. //      Color to replace with transparent black, or 0 to disable colorkey.
  333. //      This is always a 32-bit ARGB color, independent of the source image
  334. //      format.  Alpha is significant, and should usually be set to FF for 
  335. //      opaque colorkeys.  (ex. Opaque black == 0xff000000)
  336. //  pSrcInfo
  337. //      Pointer to a D3DXIMAGE_INFO structure to be filled in with the 
  338. //      description of the data in the source image file, or NULL.
  339. //
  340. //----------------------------------------------------------------------------
  341.  
  342. HRESULT WINAPI
  343.     D3DXLoadSurfaceFromFileA(
  344.         LPDIRECT3DSURFACE8        pDestSurface,
  345.         CONST PALETTEENTRY*       pDestPalette,
  346.         CONST RECT*               pDestRect,
  347.         LPCSTR                    pSrcFile,
  348.         CONST RECT*               pSrcRect,
  349.         DWORD                     Filter,
  350.         D3DCOLOR                  ColorKey,
  351.         D3DXIMAGE_INFO*           pSrcInfo);
  352.  
  353. HRESULT WINAPI
  354.     D3DXLoadSurfaceFromFileW(
  355.         LPDIRECT3DSURFACE8        pDestSurface,
  356.         CONST PALETTEENTRY*       pDestPalette,
  357.         CONST RECT*               pDestRect,
  358.         LPCWSTR                   pSrcFile,
  359.         CONST RECT*               pSrcRect,
  360.         DWORD                     Filter,
  361.         D3DCOLOR                  ColorKey,
  362.         D3DXIMAGE_INFO*           pSrcInfo);
  363.  
  364. #ifdef UNICODE
  365. #define D3DXLoadSurfaceFromFile D3DXLoadSurfaceFromFileW
  366. #else
  367. #define D3DXLoadSurfaceFromFile D3DXLoadSurfaceFromFileA
  368. #endif
  369.  
  370.  
  371.  
  372. HRESULT WINAPI
  373.     D3DXLoadSurfaceFromResourceA(
  374.         LPDIRECT3DSURFACE8        pDestSurface,
  375.         CONST PALETTEENTRY*       pDestPalette,
  376.         CONST RECT*               pDestRect,
  377.         HMODULE                   hSrcModule,
  378.         LPCSTR                    pSrcResource,
  379.         CONST RECT*               pSrcRect,
  380.         DWORD                     Filter,
  381.         D3DCOLOR                  ColorKey,
  382.         D3DXIMAGE_INFO*           pSrcInfo);
  383.  
  384. HRESULT WINAPI
  385.     D3DXLoadSurfaceFromResourceW(
  386.         LPDIRECT3DSURFACE8        pDestSurface,
  387.         CONST PALETTEENTRY*       pDestPalette,
  388.         CONST RECT*               pDestRect,
  389.         HMODULE                   hSrcModule,
  390.         LPCWSTR                   pSrcResource,
  391.         CONST RECT*               pSrcRect,
  392.         DWORD                     Filter,
  393.         D3DCOLOR                  ColorKey,
  394.         D3DXIMAGE_INFO*           pSrcInfo);
  395.  
  396.  
  397. #ifdef UNICODE
  398. #define D3DXLoadSurfaceFromResource D3DXLoadSurfaceFromResourceW
  399. #else
  400. #define D3DXLoadSurfaceFromResource D3DXLoadSurfaceFromResourceA
  401. #endif
  402.  
  403.  
  404.  
  405. HRESULT WINAPI
  406.     D3DXLoadSurfaceFromFileInMemory(
  407.         LPDIRECT3DSURFACE8        pDestSurface,
  408.         CONST PALETTEENTRY*       pDestPalette,
  409.         CONST RECT*               pDestRect,
  410.         LPCVOID                   pSrcData,
  411.         UINT                      SrcDataSize,
  412.         CONST RECT*               pSrcRect,
  413.         DWORD                     Filter,
  414.         D3DCOLOR                  ColorKey,
  415.         D3DXIMAGE_INFO*           pSrcInfo);
  416.  
  417.  
  418.  
  419. //----------------------------------------------------------------------------
  420. // D3DXLoadSurfaceFromSurface:
  421. // ---------------------------
  422. // Load surface from another surface (with color conversion)
  423. //
  424. // Parameters:
  425. //  pDestSurface
  426. //      Destination surface, which will receive the image.
  427. //  pDestPalette
  428. //      Destination palette of 256 colors, or NULL
  429. //  pDestRect
  430. //      Destination rectangle, or NULL for entire surface
  431. //  pSrcSurface
  432. //      Source surface
  433. //  pSrcPalette
  434. //      Source palette of 256 colors, or NULL
  435. //  pSrcRect
  436. //      Source rectangle, or NULL for entire surface
  437. //  Filter
  438. //      D3DX_FILTER flags controlling how the image is filtered.
  439. //      Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE.
  440. //  ColorKey
  441. //      Color to replace with transparent black, or 0 to disable colorkey.
  442. //      This is always a 32-bit ARGB color, independent of the source image
  443. //      format.  Alpha is significant, and should usually be set to FF for 
  444. //      opaque colorkeys.  (ex. Opaque black == 0xff000000)
  445. //
  446. //----------------------------------------------------------------------------
  447.  
  448. HRESULT WINAPI
  449.     D3DXLoadSurfaceFromSurface(
  450.         LPDIRECT3DSURFACE8        pDestSurface,
  451.         CONST PALETTEENTRY*       pDestPalette,
  452.         CONST RECT*               pDestRect,
  453.         LPDIRECT3DSURFACE8        pSrcSurface,
  454.         CONST PALETTEENTRY*       pSrcPalette,
  455.         CONST RECT*               pSrcRect,
  456.         DWORD                     Filter,
  457.         D3DCOLOR                  ColorKey);
  458.  
  459.  
  460. //----------------------------------------------------------------------------
  461. // D3DXLoadSurfaceFromMemory:
  462. // --------------------------
  463. // Load surface from memory.
  464. //
  465. // Parameters:
  466. //  pDestSurface
  467. //      Destination surface, which will receive the image.
  468. //  pDestPalette
  469. //      Destination palette of 256 colors, or NULL
  470. //  pDestRect
  471. //      Destination rectangle, or NULL for entire surface
  472. //  pSrcMemory
  473. //      Pointer to the top-left corner of the source image in memory
  474. //  SrcFormat
  475. //      Pixel format of the source image.
  476. //  SrcPitch
  477. //      Pitch of source image, in bytes.  For DXT formats, this number
  478. //      should represent the width of one row of cells, in bytes.
  479. //  pSrcPalette
  480. //      Source palette of 256 colors, or NULL
  481. //  pSrcRect
  482. //      Source rectangle.
  483. //  Filter
  484. //      D3DX_FILTER flags controlling how the image is filtered.
  485. //      Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE.
  486. //  ColorKey
  487. //      Color to replace with transparent black, or 0 to disable colorkey.
  488. //      This is always a 32-bit ARGB color, independent of the source image
  489. //      format.  Alpha is significant, and should usually be set to FF for 
  490. //      opaque colorkeys.  (ex. Opaque black == 0xff000000)
  491. //
  492. //----------------------------------------------------------------------------
  493.  
  494. HRESULT WINAPI
  495.     D3DXLoadSurfaceFromMemory(
  496.         LPDIRECT3DSURFACE8        pDestSurface,
  497.         CONST PALETTEENTRY*       pDestPalette,
  498.         CONST RECT*               pDestRect,
  499.         LPCVOID                   pSrcMemory,
  500.         D3DFORMAT                 SrcFormat,
  501.         UINT                      SrcPitch,
  502.         CONST PALETTEENTRY*       pSrcPalette,
  503.         CONST RECT*               pSrcRect,
  504.         DWORD                     Filter,
  505.         D3DCOLOR                  ColorKey);
  506.  
  507.  
  508. //----------------------------------------------------------------------------
  509. // D3DXSaveSurfaceToFile:
  510. // ----------------------
  511. // Save a surface to a image file.
  512. //
  513. // Parameters:
  514. //  pDestFile
  515. //      File name of the destination file
  516. //  DestFormat
  517. //      D3DXIMAGE_FILEFORMAT specifying file format to use when saving.
  518. //  pSrcSurface
  519. //      Source surface, containing the image to be saved
  520. //  pSrcPalette
  521. //      Source palette of 256 colors, or NULL
  522. //  pSrcRect
  523. //      Source rectangle, or NULL for the entire image
  524. //
  525. //----------------------------------------------------------------------------
  526.  
  527. HRESULT WINAPI
  528.     D3DXSaveSurfaceToFileA(
  529.         LPCSTR                    pDestFile,
  530.         D3DXIMAGE_FILEFORMAT      DestFormat,
  531.         LPDIRECT3DSURFACE8        pSrcSurface,
  532.         CONST PALETTEENTRY*       pSrcPalette,
  533.         CONST RECT*               pSrcRect);
  534.  
  535. HRESULT WINAPI
  536.     D3DXSaveSurfaceToFileW(
  537.         LPCWSTR                   pDestFile,
  538.         D3DXIMAGE_FILEFORMAT      DestFormat,
  539.         LPDIRECT3DSURFACE8        pSrcSurface,
  540.         CONST PALETTEENTRY*       pSrcPalette,
  541.         CONST RECT*               pSrcRect);
  542.  
  543. #ifdef UNICODE
  544. #define D3DXSaveSurfaceToFile D3DXSaveSurfaceToFileW
  545. #else
  546. #define D3DXSaveSurfaceToFile D3DXSaveSurfaceToFileA
  547. #endif
  548.  
  549.  
  550.  
  551.  
  552. //////////////////////////////////////////////////////////////////////////////
  553. // Load/Save Volume APIs /////////////////////////////////////////////////////
  554. //////////////////////////////////////////////////////////////////////////////
  555.  
  556. //----------------------------------------------------------------------------
  557. // D3DXLoadVolumeFromFile/Resource:
  558. // --------------------------------
  559. // Load volume from a file or resource
  560. //
  561. // Parameters:
  562. //  pDestVolume
  563. //      Destination volume, which will receive the image.
  564. //  pDestPalette
  565. //      Destination palette of 256 colors, or NULL
  566. //  pDestBox
  567. //      Destination box, or NULL for entire volume
  568. //  pSrcFile
  569. //      File name of the source image.
  570. //  pSrcModule
  571. //      Module where resource is located, or NULL for module associated
  572. //      with image the os used to create the current process.
  573. //  pSrcResource
  574. //      Resource name
  575. //  pSrcData
  576. //      Pointer to file in memory.
  577. //  SrcDataSize
  578. //      Size in bytes of file in memory.
  579. //  pSrcBox
  580. //      Source box, or NULL for entire image
  581. //  Filter
  582. //      D3DX_FILTER flags controlling how the image is filtered.
  583. //      Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE.
  584. //  ColorKey
  585. //      Color to replace with transparent black, or 0 to disable colorkey.
  586. //      This is always a 32-bit ARGB color, independent of the source image
  587. //      format.  Alpha is significant, and should usually be set to FF for 
  588. //      opaque colorkeys.  (ex. Opaque black == 0xff000000)
  589. //  pSrcInfo
  590. //      Pointer to a D3DXIMAGE_INFO structure to be filled in with the 
  591. //      description of the data in the source image file, or NULL.
  592. //
  593. //----------------------------------------------------------------------------
  594.  
  595. HRESULT WINAPI
  596.     D3DXLoadVolumeFromFileA(
  597.         LPDIRECT3DVOLUME8         pDestVolume,
  598.         CONST PALETTEENTRY*       pDestPalette,
  599.         CONST D3DBOX*             pDestBox,
  600.         LPCSTR                    pSrcFile,
  601.         CONST D3DBOX*             pSrcBox,
  602.         DWORD                     Filter,
  603.         D3DCOLOR                  ColorKey,
  604.         D3DXIMAGE_INFO*           pSrcInfo);
  605.  
  606. HRESULT WINAPI
  607.     D3DXLoadVolumeFromFileW(
  608.         LPDIRECT3DVOLUME8         pDestVolume,
  609.         CONST PALETTEENTRY*       pDestPalette,
  610.         CONST D3DBOX*             pDestBox,
  611.         LPCWSTR                   pSrcFile,
  612.         CONST D3DBOX*             pSrcBox,
  613.         DWORD                     Filter,
  614.         D3DCOLOR                  ColorKey,
  615.         D3DXIMAGE_INFO*           pSrcInfo);
  616.  
  617. #ifdef UNICODE
  618. #define D3DXLoadVolumeFromFile D3DXLoadVolumeFromFileW
  619. #else
  620. #define D3DXLoadVolumeFromFile D3DXLoadVolumeFromFileA
  621. #endif
  622.  
  623.  
  624. HRESULT WINAPI
  625.     D3DXLoadVolumeFromResourceA(
  626.         LPDIRECT3DVOLUME8         pDestVolume,
  627.         CONST PALETTEENTRY*       pDestPalette,
  628.         CONST D3DBOX*             pDestBox,
  629.         HMODULE                   hSrcModule,
  630.         LPCSTR                    pSrcResource,
  631.         CONST D3DBOX*             pSrcBox,
  632.         DWORD                     Filter,
  633.         D3DCOLOR                  ColorKey,
  634.         D3DXIMAGE_INFO*           pSrcInfo);
  635.  
  636. HRESULT WINAPI
  637.     D3DXLoadVolumeFromResourceW(
  638.         LPDIRECT3DVOLUME8         pDestVolume,
  639.         CONST PALETTEENTRY*       pDestPalette,
  640.         CONST D3DBOX*             pDestBox,
  641.         HMODULE                   hSrcModule,
  642.         LPCWSTR                   pSrcResource,
  643.         CONST D3DBOX*             pSrcBox,
  644.         DWORD                     Filter,
  645.         D3DCOLOR                  ColorKey,
  646.         D3DXIMAGE_INFO*           pSrcInfo);
  647.  
  648. #ifdef UNICODE
  649. #define D3DXLoadVolumeFromResource D3DXLoadVolumeFromResourceW
  650. #else
  651. #define D3DXLoadVolumeFromResource D3DXLoadVolumeFromResourceA
  652. #endif
  653.  
  654.  
  655.  
  656. HRESULT WINAPI
  657.     D3DXLoadVolumeFromFileInMemory(
  658.         LPDIRECT3DVOLUME8         pDestVolume,
  659.         CONST PALETTEENTRY*       pDestPalette,
  660.         CONST D3DBOX*             pDestBox,
  661.         LPCVOID                   pSrcData,
  662.         UINT                      SrcDataSize,
  663.         CONST D3DBOX*             pSrcBox,
  664.         DWORD                     Filter,
  665.         D3DCOLOR                  ColorKey,
  666.         D3DXIMAGE_INFO*           pSrcInfo);
  667.  
  668.  
  669.  
  670. //----------------------------------------------------------------------------
  671. // D3DXLoadVolumeFromVolume:
  672. // -------------------------
  673. // Load volume from another volume (with color conversion)
  674. //
  675. // Parameters:
  676. //  pDestVolume
  677. //      Destination volume, which will receive the image.
  678. //  pDestPalette
  679. //      Destination palette of 256 colors, or NULL
  680. //  pDestBox
  681. //      Destination box, or NULL for entire volume
  682. //  pSrcVolume
  683. //      Source volume
  684. //  pSrcPalette
  685. //      Source palette of 256 colors, or NULL
  686. //  pSrcBox
  687. //      Source box, or NULL for entire volume
  688. //  Filter
  689. //      D3DX_FILTER flags controlling how the image is filtered.
  690. //      Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE.
  691. //  ColorKey
  692. //      Color to replace with transparent black, or 0 to disable colorkey.
  693. //      This is always a 32-bit ARGB color, independent of the source image
  694. //      format.  Alpha is significant, and should usually be set to FF for 
  695. //      opaque colorkeys.  (ex. Opaque black == 0xff000000)
  696. //
  697. //----------------------------------------------------------------------------
  698.  
  699. HRESULT WINAPI
  700.     D3DXLoadVolumeFromVolume(
  701.         LPDIRECT3DVOLUME8         pDestVolume,
  702.         CONST PALETTEENTRY*       pDestPalette,
  703.         CONST D3DBOX*             pDestBox,
  704.         LPDIRECT3DVOLUME8         pSrcVolume,
  705.         CONST PALETTEENTRY*       pSrcPalette,
  706.         CONST D3DBOX*             pSrcBox,
  707.         DWORD                     Filter,
  708.         D3DCOLOR                  ColorKey);
  709.  
  710.  
  711.  
  712. //----------------------------------------------------------------------------
  713. // D3DXLoadVolumeFromMemory:
  714. // -------------------------
  715. // Load volume from memory.
  716. //
  717. // Parameters:
  718. //  pDestVolume
  719. //      Destination volume, which will receive the image.
  720. //  pDestPalette
  721. //      Destination palette of 256 colors, or NULL
  722. //  pDestBox
  723. //      Destination box, or NULL for entire volume
  724. //  pSrcMemory
  725. //      Pointer to the top-left corner of the source volume in memory
  726. //  SrcFormat
  727. //      Pixel format of the source volume.
  728. //  SrcRowPitch
  729. //      Pitch of source image, in bytes.  For DXT formats, this number
  730. //      should represent the size of one row of cells, in bytes.
  731. //  SrcSlicePitch
  732. //      Pitch of source image, in bytes.  For DXT formats, this number
  733. //      should represent the size of one slice of cells, in bytes.
  734. //  pSrcPalette
  735. //      Source palette of 256 colors, or NULL
  736. //  pSrcBox
  737. //      Source box.
  738. //  Filter
  739. //      D3DX_FILTER flags controlling how the image is filtered.
  740. //      Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE.
  741. //  ColorKey
  742. //      Color to replace with transparent black, or 0 to disable colorkey.
  743. //      This is always a 32-bit ARGB color, independent of the source image
  744. //      format.  Alpha is significant, and should usually be set to FF for 
  745. //      opaque colorkeys.  (ex. Opaque black == 0xff000000)
  746. //
  747. //----------------------------------------------------------------------------
  748.  
  749. HRESULT WINAPI
  750.     D3DXLoadVolumeFromMemory(
  751.         LPDIRECT3DVOLUME8         pDestVolume,
  752.         CONST PALETTEENTRY*       pDestPalette,
  753.         CONST D3DBOX*             pDestBox,
  754.         LPCVOID                   pSrcMemory,
  755.         D3DFORMAT                 SrcFormat,
  756.         UINT                      SrcRowPitch,
  757.         UINT                      SrcSlicePitch,
  758.         CONST PALETTEENTRY*       pSrcPalette,
  759.         CONST D3DBOX*             pSrcBox,
  760.         DWORD                     Filter,
  761.         D3DCOLOR                  ColorKey);
  762.  
  763.  
  764.  
  765. //----------------------------------------------------------------------------
  766. // D3DXSaveVolumeToFile:
  767. // ---------------------
  768. // Save a volume to a image file.
  769. //
  770. // Parameters:
  771. //  pDestFile
  772. //      File name of the destination file
  773. //  DestFormat
  774. //      D3DXIMAGE_FILEFORMAT specifying file format to use when saving.
  775. //  pSrcVolume
  776. //      Source volume, containing the image to be saved
  777. //  pSrcPalette
  778. //      Source palette of 256 colors, or NULL
  779. //  pSrcBox
  780. //      Source box, or NULL for the entire volume
  781. //
  782. //----------------------------------------------------------------------------
  783.  
  784. HRESULT WINAPI
  785.     D3DXSaveVolumeToFileA(
  786.         LPCSTR                    pDestFile,
  787.         D3DXIMAGE_FILEFORMAT      DestFormat,
  788.         LPDIRECT3DVOLUME8         pSrcVolume,
  789.         CONST PALETTEENTRY*       pSrcPalette,
  790.         CONST D3DBOX*             pSrcBox);
  791.  
  792. HRESULT WINAPI
  793.     D3DXSaveVolumeToFileW(
  794.         LPCWSTR                   pDestFile,
  795.         D3DXIMAGE_FILEFORMAT      DestFormat,
  796.         LPDIRECT3DVOLUME8         pSrcVolume,
  797.         CONST PALETTEENTRY*       pSrcPalette,
  798.         CONST D3DBOX*             pSrcBox);
  799.  
  800. #ifdef UNICODE
  801. #define D3DXSaveVolumeToFile D3DXSaveVolumeToFileW
  802. #else
  803. #define D3DXSaveVolumeToFile D3DXSaveVolumeToFileA
  804. #endif
  805.  
  806.  
  807.  
  808.  
  809. //////////////////////////////////////////////////////////////////////////////
  810. // Create/Save Texture APIs //////////////////////////////////////////////////
  811. //////////////////////////////////////////////////////////////////////////////
  812.  
  813. //----------------------------------------------------------------------------
  814. // D3DXCheckTextureRequirements:
  815. // -----------------------------
  816. // Checks texture creation parameters.  If parameters are invalid, this
  817. // function returns corrected parameters.
  818. //
  819. // Parameters:
  820. //
  821. //  pDevice
  822. //      The D3D device to be used
  823. //  pWidth, pHeight, pDepth, pSize
  824. //      Desired size in pixels, or NULL.  Returns corrected size.
  825. //  pNumMipLevels
  826. //      Number of desired mipmap levels, or NULL.  Returns corrected number.
  827. //  Usage
  828. //      Texture usage flags
  829. //  pFormat
  830. //      Desired pixel format, or NULL.  Returns corrected format.
  831. //  Pool
  832. //      Memory pool to be used to create texture
  833. //
  834. //----------------------------------------------------------------------------
  835.  
  836. HRESULT WINAPI
  837.     D3DXCheckTextureRequirements(
  838.         LPDIRECT3DDEVICE8         pDevice,
  839.         UINT*                     pWidth,
  840.         UINT*                     pHeight,
  841.         UINT*                     pNumMipLevels,
  842.         DWORD                     Usage,
  843.         D3DFORMAT*                pFormat,
  844.         D3DPOOL                   Pool);
  845.  
  846. HRESULT WINAPI
  847.     D3DXCheckCubeTextureRequirements(
  848.         LPDIRECT3DDEVICE8         pDevice,
  849.         UINT*                     pSize,
  850.         UINT*                     pNumMipLevels,
  851.         DWORD                     Usage,
  852.         D3DFORMAT*                pFormat,
  853.         D3DPOOL                   Pool);
  854.  
  855. HRESULT WINAPI
  856.     D3DXCheckVolumeTextureRequirements(
  857.         LPDIRECT3DDEVICE8         pDevice,
  858.         UINT*                     pWidth,
  859.         UINT*                     pHeight,
  860.         UINT*                     pDepth,
  861.         UINT*                     pNumMipLevels,
  862.         DWORD                     Usage,
  863.         D3DFORMAT*                pFormat,
  864.         D3DPOOL                   Pool);
  865.  
  866.  
  867. //----------------------------------------------------------------------------
  868. // D3DXCreateTexture:
  869. // ------------------
  870. // Create an empty texture
  871. //
  872. // Parameters:
  873. //
  874. //  pDevice
  875. //      The D3D device with which the texture is going to be used.
  876. //  Width, Height, Depth, Size
  877. //      size in pixels; these must be non-zero
  878. //  MipLevels
  879. //      number of mip levels desired; if zero or D3DX_DEFAULT, a complete
  880. //      mipmap chain will be created.
  881. //  Usage
  882. //      Texture usage flags
  883. //  Format
  884. //      Pixel format.
  885. //  Pool
  886. //      Memory pool to be used to create texture
  887. //  ppTexture, ppCubeTexture, ppVolumeTexture
  888. //      The texture object that will be created
  889. //
  890. //----------------------------------------------------------------------------
  891.  
  892. HRESULT WINAPI
  893.     D3DXCreateTexture(
  894.         LPDIRECT3DDEVICE8         pDevice,
  895.         UINT                      Width,
  896.         UINT                      Height,
  897.         UINT                      MipLevels,
  898.         DWORD                     Usage,
  899.         D3DFORMAT                 Format,
  900.         D3DPOOL                   Pool,
  901.         LPDIRECT3DTEXTURE8*       ppTexture);
  902.  
  903. HRESULT WINAPI
  904.     D3DXCreateCubeTexture(
  905.         LPDIRECT3DDEVICE8         pDevice,
  906.         UINT                      Size,
  907.         UINT                      MipLevels,
  908.         DWORD                     Usage,
  909.         D3DFORMAT                 Format,
  910.         D3DPOOL                   Pool,
  911.         LPDIRECT3DCUBETEXTURE8*   ppCubeTexture);
  912.  
  913. HRESULT WINAPI
  914.     D3DXCreateVolumeTexture(
  915.         LPDIRECT3DDEVICE8         pDevice,
  916.         UINT                      Width,
  917.         UINT                      Height,
  918.         UINT                      Depth,
  919.         UINT                      MipLevels,
  920.         DWORD                     Usage,
  921.         D3DFORMAT                 Format,
  922.         D3DPOOL                   Pool,
  923.         LPDIRECT3DVOLUMETEXTURE8* ppVolumeTexture);
  924.  
  925.  
  926.  
  927. //----------------------------------------------------------------------------
  928. // D3DXCreateTextureFromFile/Resource:
  929. // -----------------------------------
  930. // Create a texture object from a file or resource.
  931. //
  932. // Parameters:
  933. //
  934. //  pDevice
  935. //      The D3D device with which the texture is going to be used.
  936. //  pSrcFile
  937. //      File name.
  938. //  hSrcModule
  939. //      Module handle. if NULL, current module will be used.
  940. //  pSrcResource
  941. //      Resource name in module
  942. //  pvSrcData
  943. //      Pointer to file in memory.
  944. //  SrcDataSize
  945. //      Size in bytes of file in memory.
  946. //  Width, Height, Depth, Size
  947. //      Size in pixels; if zero or D3DX_DEFAULT, the size will be taken
  948. //      from the file.
  949. //  MipLevels
  950. //      Number of mip levels;  if zero or D3DX_DEFAULT, a complete mipmap
  951. //      chain will be created.
  952. //  Usage
  953. //      Texture usage flags
  954. //  Format
  955. //      Desired pixel format.  If D3DFMT_UNKNOWN, the format will be
  956. //      taken from the file.
  957. //  Pool
  958. //      Memory pool to be used to create texture
  959. //  Filter
  960. //      D3DX_FILTER flags controlling how the image is filtered.
  961. //      Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE.
  962. //  MipFilter
  963. //      D3DX_FILTER flags controlling how each miplevel is filtered.
  964. //      Or D3DX_DEFAULT for D3DX_FILTER_BOX,
  965. //  ColorKey
  966. //      Color to replace with transparent black, or 0 to disable colorkey.
  967. //      This is always a 32-bit ARGB color, independent of the source image
  968. //      format.  Alpha is significant, and should usually be set to FF for 
  969. //      opaque colorkeys.  (ex. Opaque black == 0xff000000)
  970. //  pSrcInfo
  971. //      Pointer to a D3DXIMAGE_INFO structure to be filled in with the 
  972. //      description of the data in the source image file, or NULL.
  973. //  pPalette
  974. //      256 color palette to be filled in, or NULL
  975. //  ppTexture, ppCubeTexture, ppVolumeTexture
  976. //      The texture object that will be created
  977. //
  978. //----------------------------------------------------------------------------
  979.  
  980.  
  981. // FromFile
  982.  
  983. HRESULT WINAPI
  984.     D3DXCreateTextureFromFileA(
  985.         LPDIRECT3DDEVICE8         pDevice,
  986.         LPCSTR                    pSrcFile,
  987.         LPDIRECT3DTEXTURE8*       ppTexture);
  988.  
  989. HRESULT WINAPI
  990.     D3DXCreateTextureFromFileW(
  991.         LPDIRECT3DDEVICE8         pDevice,
  992.         LPCWSTR                   pSrcFile,
  993.         LPDIRECT3DTEXTURE8*       ppTexture);
  994.  
  995. #ifdef UNICODE
  996. #define D3DXCreateTextureFromFile D3DXCreateTextureFromFileW
  997. #else
  998. #define D3DXCreateTextureFromFile D3DXCreateTextureFromFileA
  999. #endif
  1000.  
  1001.  
  1002. HRESULT WINAPI
  1003.     D3DXCreateCubeTextureFromFileA(
  1004.         LPDIRECT3DDEVICE8         pDevice,
  1005.         LPCSTR                    pSrcFile,
  1006.         LPDIRECT3DCUBETEXTURE8*   ppCubeTexture);
  1007.  
  1008. HRESULT WINAPI
  1009.     D3DXCreateCubeTextureFromFileW(
  1010.         LPDIRECT3DDEVICE8         pDevice,
  1011.         LPCWSTR                   pSrcFile,
  1012.         LPDIRECT3DCUBETEXTURE8*   ppCubeTexture);
  1013.  
  1014. #ifdef UNICODE
  1015. #define D3DXCreateCubeTextureFromFile D3DXCreateCubeTextureFromFileW
  1016. #else
  1017. #define D3DXCreateCubeTextureFromFile D3DXCreateCubeTextureFromFileA
  1018. #endif
  1019.  
  1020.  
  1021. HRESULT WINAPI
  1022.     D3DXCreateVolumeTextureFromFileA(
  1023.         LPDIRECT3DDEVICE8         pDevice,
  1024.         LPCSTR                    pSrcFile,
  1025.         LPDIRECT3DVOLUMETEXTURE8* ppVolumeTexture);
  1026.  
  1027. HRESULT WINAPI
  1028.     D3DXCreateVolumeTextureFromFileW(
  1029.         LPDIRECT3DDEVICE8         pDevice,
  1030.         LPCWSTR                   pSrcFile,
  1031.         LPDIRECT3DVOLUMETEXTURE8* ppVolumeTexture);
  1032.  
  1033. #ifdef UNICODE
  1034. #define D3DXCreateVolumeTextureFromFile D3DXCreateVolumeTextureFromFileW
  1035. #else
  1036. #define D3DXCreateVolumeTextureFromFile D3DXCreateVolumeTextureFromFileA
  1037. #endif
  1038.  
  1039.  
  1040. // FromResource
  1041.  
  1042. HRESULT WINAPI
  1043.     D3DXCreateTextureFromResourceA(
  1044.         LPDIRECT3DDEVICE8         pDevice,
  1045.         HMODULE                   hSrcModule,
  1046.         LPCSTR                    pSrcResource,
  1047.         LPDIRECT3DTEXTURE8*       ppTexture);
  1048.  
  1049. HRESULT WINAPI
  1050.     D3DXCreateTextureFromResourceW(
  1051.         LPDIRECT3DDEVICE8         pDevice,
  1052.         HMODULE                   hSrcModule,
  1053.         LPCWSTR                   pSrcResource,
  1054.         LPDIRECT3DTEXTURE8*       ppTexture);
  1055.  
  1056. #ifdef UNICODE
  1057. #define D3DXCreateTextureFromResource D3DXCreateTextureFromResourceW
  1058. #else
  1059. #define D3DXCreateTextureFromResource D3DXCreateTextureFromResourceA
  1060. #endif
  1061.  
  1062.  
  1063. HRESULT WINAPI
  1064.     D3DXCreateCubeTextureFromResourceA(
  1065.         LPDIRECT3DDEVICE8         pDevice,
  1066.         HMODULE                   hSrcModule,
  1067.         LPCSTR                    pSrcResource,
  1068.         LPDIRECT3DCUBETEXTURE8*   ppCubeTexture);
  1069.  
  1070. HRESULT WINAPI
  1071.     D3DXCreateCubeTextureFromResourceW(
  1072.         LPDIRECT3DDEVICE8         pDevice,
  1073.         HMODULE                   hSrcModule,
  1074.         LPCWSTR                   pSrcResource,
  1075.         LPDIRECT3DCUBETEXTURE8*   ppCubeTexture);
  1076.  
  1077. #ifdef UNICODE
  1078. #define D3DXCreateCubeTextureFromResource D3DXCreateCubeTextureFromResourceW
  1079. #else
  1080. #define D3DXCreateCubeTextureFromResource D3DXCreateCubeTextureFromResourceA
  1081. #endif
  1082.  
  1083.  
  1084. HRESULT WINAPI
  1085.     D3DXCreateVolumeTextureFromResourceA(
  1086.         LPDIRECT3DDEVICE8         pDevice,
  1087.         HMODULE                   hSrcModule,
  1088.         LPCSTR                    pSrcResource,
  1089.         LPDIRECT3DVOLUMETEXTURE8* ppVolumeTexture);
  1090.  
  1091. HRESULT WINAPI
  1092.     D3DXCreateVolumeTextureFromResourceW(
  1093.         LPDIRECT3DDEVICE8         pDevice,
  1094.         HMODULE                   hSrcModule,
  1095.         LPCWSTR                   pSrcResource,
  1096.         LPDIRECT3DVOLUMETEXTURE8* ppVolumeTexture);
  1097.  
  1098. #ifdef UNICODE
  1099. #define D3DXCreateVolumeTextureFromResource D3DXCreateVolumeTextureFromResourceW
  1100. #else
  1101. #define D3DXCreateVolumeTextureFromResource D3DXCreateVolumeTextureFromResourceA
  1102. #endif
  1103.  
  1104.  
  1105. // FromFileEx
  1106.  
  1107. HRESULT WINAPI
  1108.     D3DXCreateTextureFromFileExA(
  1109.         LPDIRECT3DDEVICE8         pDevice,
  1110.         LPCSTR                    pSrcFile,
  1111.         UINT                      Width,
  1112.         UINT                      Height,
  1113.         UINT                      MipLevels,
  1114.         DWORD                     Usage,
  1115.         D3DFORMAT                 Format,
  1116.         D3DPOOL                   Pool,
  1117.         DWORD                     Filter,
  1118.         DWORD                     MipFilter,
  1119.         D3DCOLOR                  ColorKey,
  1120.         D3DXIMAGE_INFO*           pSrcInfo,
  1121.         PALETTEENTRY*             pPalette,
  1122.         LPDIRECT3DTEXTURE8*       ppTexture);
  1123.  
  1124. HRESULT WINAPI
  1125.     D3DXCreateTextureFromFileExW(
  1126.         LPDIRECT3DDEVICE8         pDevice,
  1127.         LPCWSTR                   pSrcFile,
  1128.         UINT                      Width,
  1129.         UINT                      Height,
  1130.         UINT                      MipLevels,
  1131.         DWORD                     Usage,
  1132.         D3DFORMAT                 Format,
  1133.         D3DPOOL                   Pool,
  1134.         DWORD                     Filter,
  1135.         DWORD                     MipFilter,
  1136.         D3DCOLOR                  ColorKey,
  1137.         D3DXIMAGE_INFO*           pSrcInfo,
  1138.         PALETTEENTRY*             pPalette,
  1139.         LPDIRECT3DTEXTURE8*       ppTexture);
  1140.  
  1141. #ifdef UNICODE
  1142. #define D3DXCreateTextureFromFileEx D3DXCreateTextureFromFileExW
  1143. #else
  1144. #define D3DXCreateTextureFromFileEx D3DXCreateTextureFromFileExA
  1145. #endif
  1146.  
  1147.  
  1148. HRESULT WINAPI
  1149.     D3DXCreateCubeTextureFromFileExA(
  1150.         LPDIRECT3DDEVICE8         pDevice,
  1151.         LPCSTR                    pSrcFile,
  1152.         UINT                      Size,
  1153.         UINT                      MipLevels,
  1154.         DWORD                     Usage,
  1155.         D3DFORMAT                 Format,
  1156.         D3DPOOL                   Pool,
  1157.         DWORD                     Filter,
  1158.         DWORD                     MipFilter,
  1159.         D3DCOLOR                  ColorKey,
  1160.         D3DXIMAGE_INFO*           pSrcInfo,
  1161.         PALETTEENTRY*             pPalette,
  1162.         LPDIRECT3DCUBETEXTURE8*   ppCubeTexture);
  1163.  
  1164. HRESULT WINAPI
  1165.     D3DXCreateCubeTextureFromFileExW(
  1166.         LPDIRECT3DDEVICE8         pDevice,
  1167.         LPCWSTR                   pSrcFile,
  1168.         UINT                      Size,
  1169.         UINT                      MipLevels,
  1170.         DWORD                     Usage,
  1171.         D3DFORMAT                 Format,
  1172.         D3DPOOL                   Pool,
  1173.         DWORD                     Filter,
  1174.         DWORD                     MipFilter,
  1175.         D3DCOLOR                  ColorKey,
  1176.         D3DXIMAGE_INFO*           pSrcInfo,
  1177.         PALETTEENTRY*             pPalette,
  1178.         LPDIRECT3DCUBETEXTURE8*   ppCubeTexture);
  1179.  
  1180. #ifdef UNICODE
  1181. #define D3DXCreateCubeTextureFromFileEx D3DXCreateCubeTextureFromFileExW
  1182. #else
  1183. #define D3DXCreateCubeTextureFromFileEx D3DXCreateCubeTextureFromFileExA
  1184. #endif
  1185.  
  1186.  
  1187. HRESULT WINAPI
  1188.     D3DXCreateVolumeTextureFromFileExA(
  1189.         LPDIRECT3DDEVICE8         pDevice,
  1190.         LPCSTR                    pSrcFile,
  1191.         UINT                      Width,
  1192.         UINT                      Height,
  1193.         UINT                      Depth,
  1194.         UINT                      MipLevels,
  1195.         DWORD                     Usage,
  1196.         D3DFORMAT                 Format,
  1197.         D3DPOOL                   Pool,
  1198.         DWORD                     Filter,
  1199.         DWORD                     MipFilter,
  1200.         D3DCOLOR                  ColorKey,
  1201.         D3DXIMAGE_INFO*           pSrcInfo,
  1202.         PALETTEENTRY*             pPalette,
  1203.         LPDIRECT3DVOLUMETEXTURE8* ppVolumeTexture);
  1204.  
  1205. HRESULT WINAPI
  1206.     D3DXCreateVolumeTextureFromFileExW(
  1207.         LPDIRECT3DDEVICE8         pDevice,
  1208.         LPCWSTR                   pSrcFile,
  1209.         UINT                      Width,
  1210.         UINT                      Height,
  1211.         UINT                      Depth,
  1212.         UINT                      MipLevels,
  1213.         DWORD                     Usage,
  1214.         D3DFORMAT                 Format,
  1215.         D3DPOOL                   Pool,
  1216.         DWORD                     Filter,
  1217.         DWORD                     MipFilter,
  1218.         D3DCOLOR                  ColorKey,
  1219.         D3DXIMAGE_INFO*           pSrcInfo,
  1220.         PALETTEENTRY*             pPalette,
  1221.         LPDIRECT3DVOLUMETEXTURE8* ppVolumeTexture);
  1222.  
  1223. #ifdef UNICODE
  1224. #define D3DXCreateVolumeTextureFromFileEx D3DXCreateVolumeTextureFromFileExW
  1225. #else
  1226. #define D3DXCreateVolumeTextureFromFileEx D3DXCreateVolumeTextureFromFileExA
  1227. #endif
  1228.  
  1229.  
  1230. // FromResourceEx
  1231.  
  1232. HRESULT WINAPI
  1233.     D3DXCreateTextureFromResourceExA(
  1234.         LPDIRECT3DDEVICE8         pDevice,
  1235.         HMODULE                   hSrcModule,
  1236.         LPCSTR                    pSrcResource,
  1237.         UINT                      Width,
  1238.         UINT                      Height,
  1239.         UINT                      MipLevels,
  1240.         DWORD                     Usage,
  1241.         D3DFORMAT                 Format,
  1242.         D3DPOOL                   Pool,
  1243.         DWORD                     Filter,
  1244.         DWORD                     MipFilter,
  1245.         D3DCOLOR                  ColorKey,
  1246.         D3DXIMAGE_INFO*           pSrcInfo,
  1247.         PALETTEENTRY*             pPalette,
  1248.         LPDIRECT3DTEXTURE8*       ppTexture);
  1249.  
  1250. HRESULT WINAPI
  1251.     D3DXCreateTextureFromResourceExW(
  1252.         LPDIRECT3DDEVICE8         pDevice,
  1253.         HMODULE                   hSrcModule,
  1254.         LPCWSTR                   pSrcResource,
  1255.         UINT                      Width,
  1256.         UINT                      Height,
  1257.         UINT                      MipLevels,
  1258.         DWORD                     Usage,
  1259.         D3DFORMAT                 Format,
  1260.         D3DPOOL                   Pool,
  1261.         DWORD                     Filter,
  1262.         DWORD                     MipFilter,
  1263.         D3DCOLOR                  ColorKey,
  1264.         D3DXIMAGE_INFO*           pSrcInfo,
  1265.         PALETTEENTRY*             pPalette,
  1266.         LPDIRECT3DTEXTURE8*       ppTexture);
  1267.  
  1268. #ifdef UNICODE
  1269. #define D3DXCreateTextureFromResourceEx D3DXCreateTextureFromResourceExW
  1270. #else
  1271. #define D3DXCreateTextureFromResourceEx D3DXCreateTextureFromResourceExA
  1272. #endif
  1273.  
  1274.  
  1275. HRESULT WINAPI
  1276.     D3DXCreateCubeTextureFromResourceExA(
  1277.         LPDIRECT3DDEVICE8         pDevice,
  1278.         HMODULE                   hSrcModule,
  1279.         LPCSTR                    pSrcResource,
  1280.         UINT                      Size,
  1281.         UINT                      MipLevels,
  1282.         DWORD                     Usage,
  1283.         D3DFORMAT                 Format,
  1284.         D3DPOOL                   Pool,
  1285.         DWORD                     Filter,
  1286.         DWORD                     MipFilter,
  1287.         D3DCOLOR                  ColorKey,
  1288.         D3DXIMAGE_INFO*           pSrcInfo,
  1289.         PALETTEENTRY*             pPalette,
  1290.         LPDIRECT3DCUBETEXTURE8*   ppCubeTexture);
  1291.  
  1292. HRESULT WINAPI
  1293.     D3DXCreateCubeTextureFromResourceExW(
  1294.         LPDIRECT3DDEVICE8         pDevice,
  1295.         HMODULE                   hSrcModule,
  1296.         LPCWSTR                   pSrcResource,
  1297.         UINT                      Size,
  1298.         UINT                      MipLevels,
  1299.         DWORD                     Usage,
  1300.         D3DFORMAT                 Format,
  1301.         D3DPOOL                   Pool,
  1302.         DWORD                     Filter,
  1303.         DWORD                     MipFilter,
  1304.         D3DCOLOR                  ColorKey,
  1305.         D3DXIMAGE_INFO*           pSrcInfo,
  1306.         PALETTEENTRY*             pPalette,
  1307.         LPDIRECT3DCUBETEXTURE8*   ppCubeTexture);
  1308.  
  1309. #ifdef UNICODE
  1310. #define D3DXCreateCubeTextureFromResourceEx D3DXCreateCubeTextureFromResourceExW
  1311. #else
  1312. #define D3DXCreateCubeTextureFromResourceEx D3DXCreateCubeTextureFromResourceExA
  1313. #endif
  1314.  
  1315.  
  1316. HRESULT WINAPI
  1317.     D3DXCreateVolumeTextureFromResourceExA(
  1318.         LPDIRECT3DDEVICE8         pDevice,
  1319.         HMODULE                   hSrcModule,
  1320.         LPCSTR                    pSrcResource,
  1321.         UINT                      Width,
  1322.         UINT                      Height,
  1323.         UINT                      Depth,
  1324.         UINT                      MipLevels,
  1325.         DWORD                     Usage,
  1326.         D3DFORMAT                 Format,
  1327.         D3DPOOL                   Pool,
  1328.         DWORD                     Filter,
  1329.         DWORD                     MipFilter,
  1330.         D3DCOLOR                  ColorKey,
  1331.         D3DXIMAGE_INFO*           pSrcInfo,
  1332.         PALETTEENTRY*             pPalette,
  1333.         LPDIRECT3DVOLUMETEXTURE8* ppVolumeTexture);
  1334.  
  1335. HRESULT WINAPI
  1336.     D3DXCreateVolumeTextureFromResourceExW(
  1337.         LPDIRECT3DDEVICE8         pDevice,
  1338.         HMODULE                   hSrcModule,
  1339.         LPCWSTR                   pSrcResource,
  1340.         UINT                      Width,
  1341.         UINT                      Height,
  1342.         UINT                      Depth,
  1343.         UINT                      MipLevels,
  1344.         DWORD                     Usage,
  1345.         D3DFORMAT                 Format,
  1346.         D3DPOOL                   Pool,
  1347.         DWORD                     Filter,
  1348.         DWORD                     MipFilter,
  1349.         D3DCOLOR                  ColorKey,
  1350.         D3DXIMAGE_INFO*           pSrcInfo,
  1351.         PALETTEENTRY*             pPalette,
  1352.         LPDIRECT3DVOLUMETEXTURE8* ppVolumeTexture);
  1353.  
  1354. #ifdef UNICODE
  1355. #define D3DXCreateVolumeTextureFromResourceEx D3DXCreateVolumeTextureFromResourceExW
  1356. #else
  1357. #define D3DXCreateVolumeTextureFromResourceEx D3DXCreateVolumeTextureFromResourceExA
  1358. #endif
  1359.  
  1360.  
  1361. // FromFileInMemory
  1362.  
  1363. HRESULT WINAPI
  1364.     D3DXCreateTextureFromFileInMemory(
  1365.         LPDIRECT3DDEVICE8         pDevice,
  1366.         LPCVOID                   pSrcData,
  1367.         UINT                      SrcDataSize,
  1368.         LPDIRECT3DTEXTURE8*       ppTexture);
  1369.  
  1370. HRESULT WINAPI
  1371.     D3DXCreateCubeTextureFromFileInMemory(
  1372.         LPDIRECT3DDEVICE8         pDevice,
  1373.         LPCVOID                   pSrcData,
  1374.         UINT                      SrcDataSize,
  1375.         LPDIRECT3DCUBETEXTURE8*   ppCubeTexture);
  1376.  
  1377. HRESULT WINAPI
  1378.     D3DXCreateVolumeTextureFromFileInMemory(
  1379.         LPDIRECT3DDEVICE8         pDevice,
  1380.         LPCVOID                   pSrcData,
  1381.         UINT                      SrcDataSize,
  1382.         LPDIRECT3DVOLUMETEXTURE8* ppVolumeTexture);
  1383.  
  1384.  
  1385. // FromFileInMemoryEx
  1386.  
  1387. HRESULT WINAPI
  1388.     D3DXCreateTextureFromFileInMemoryEx(
  1389.         LPDIRECT3DDEVICE8         pDevice,
  1390.         LPCVOID                   pSrcData,
  1391.         UINT                      SrcDataSize,
  1392.         UINT                      Width,
  1393.         UINT                      Height,
  1394.         UINT                      MipLevels,
  1395.         DWORD                     Usage,
  1396.         D3DFORMAT                 Format,
  1397.         D3DPOOL                   Pool,
  1398.         DWORD                     Filter,
  1399.         DWORD                     MipFilter,
  1400.         D3DCOLOR                  ColorKey,
  1401.         D3DXIMAGE_INFO*           pSrcInfo,
  1402.         PALETTEENTRY*             pPalette,
  1403.         LPDIRECT3DTEXTURE8*       ppTexture);
  1404.  
  1405. HRESULT WINAPI
  1406.     D3DXCreateCubeTextureFromFileInMemoryEx(
  1407.         LPDIRECT3DDEVICE8         pDevice,
  1408.         LPCVOID                   pSrcData,
  1409.         UINT                      SrcDataSize,
  1410.         UINT                      Size,
  1411.         UINT                      MipLevels,
  1412.         DWORD                     Usage,
  1413.         D3DFORMAT                 Format,
  1414.         D3DPOOL                   Pool,
  1415.         DWORD                     Filter,
  1416.         DWORD                     MipFilter,
  1417.         D3DCOLOR                  ColorKey,
  1418.         D3DXIMAGE_INFO*           pSrcInfo,
  1419.         PALETTEENTRY*             pPalette,
  1420.         LPDIRECT3DCUBETEXTURE8*   ppCubeTexture);
  1421.  
  1422. HRESULT WINAPI
  1423.     D3DXCreateVolumeTextureFromFileInMemoryEx(
  1424.         LPDIRECT3DDEVICE8         pDevice,
  1425.         LPCVOID                   pSrcData,
  1426.         UINT                      SrcDataSize,
  1427.         UINT                      Width,
  1428.         UINT                      Height,
  1429.         UINT                      Depth,
  1430.         UINT                      MipLevels,
  1431.         DWORD                     Usage,
  1432.         D3DFORMAT                 Format,
  1433.         D3DPOOL                   Pool,
  1434.         DWORD                     Filter,
  1435.         DWORD                     MipFilter,
  1436.         D3DCOLOR                  ColorKey,
  1437.         D3DXIMAGE_INFO*           pSrcInfo,
  1438.         PALETTEENTRY*             pPalette,
  1439.         LPDIRECT3DVOLUMETEXTURE8* ppVolumeTexture);
  1440.  
  1441.  
  1442.  
  1443. //----------------------------------------------------------------------------
  1444. // D3DXSaveTextureToFile:
  1445. // ----------------------
  1446. // Save a texture to a file.
  1447. //
  1448. // Parameters:
  1449. //  pDestFile
  1450. //      File name of the destination file
  1451. //  DestFormat
  1452. //      D3DXIMAGE_FILEFORMAT specifying file format to use when saving.
  1453. //  pSrcTexture
  1454. //      Source texture, containing the image to be saved
  1455. //  pSrcPalette
  1456. //      Source palette of 256 colors, or NULL
  1457. //
  1458. //----------------------------------------------------------------------------
  1459.  
  1460.  
  1461. HRESULT WINAPI
  1462.     D3DXSaveTextureToFileA(
  1463.         LPCSTR                    pDestFile,
  1464.         D3DXIMAGE_FILEFORMAT      DestFormat,
  1465.         LPDIRECT3DBASETEXTURE8    pSrcTexture,
  1466.         CONST PALETTEENTRY*       pSrcPalette);
  1467.  
  1468. HRESULT WINAPI
  1469.     D3DXSaveTextureToFileW(
  1470.         LPCWSTR                   pDestFile,
  1471.         D3DXIMAGE_FILEFORMAT      DestFormat,
  1472.         LPDIRECT3DBASETEXTURE8    pSrcTexture,
  1473.         CONST PALETTEENTRY*       pSrcPalette);
  1474.  
  1475. #ifdef UNICODE
  1476. #define D3DXSaveTextureToFile D3DXSaveTextureToFileW
  1477. #else
  1478. #define D3DXSaveTextureToFile D3DXSaveTextureToFileA
  1479. #endif
  1480.  
  1481.  
  1482.  
  1483.  
  1484. //////////////////////////////////////////////////////////////////////////////
  1485. // Misc Texture APIs /////////////////////////////////////////////////////////
  1486. //////////////////////////////////////////////////////////////////////////////
  1487.  
  1488. //----------------------------------------------------------------------------
  1489. // D3DXFilterTexture:
  1490. // ------------------
  1491. // Filters mipmaps levels of a texture.
  1492. //
  1493. // Parameters:
  1494. //  pBaseTexture
  1495. //      The texture object to be filtered
  1496. //  pPalette
  1497. //      256 color palette to be used, or NULL for non-palettized formats
  1498. //  SrcLevel
  1499. //      The level whose image is used to generate the subsequent levels. 
  1500. //  Filter
  1501. //      D3DX_FILTER flags controlling how each miplevel is filtered.
  1502. //      Or D3DX_DEFAULT for D3DX_FILTER_BOX,
  1503. //
  1504. //----------------------------------------------------------------------------
  1505.  
  1506. HRESULT WINAPI
  1507.     D3DXFilterTexture(
  1508.         LPDIRECT3DBASETEXTURE8    pBaseTexture,
  1509.         CONST PALETTEENTRY*       pPalette,
  1510.         UINT                      SrcLevel,
  1511.         DWORD                     Filter);
  1512.  
  1513. #define D3DXFilterCubeTexture D3DXFilterTexture
  1514. #define D3DXFilterVolumeTexture D3DXFilterTexture
  1515.  
  1516.  
  1517.  
  1518. //----------------------------------------------------------------------------
  1519. // D3DXFillTexture:
  1520. // ----------------
  1521. // Uses a user provided function to fill each texel of each mip level of a
  1522. // given texture.
  1523. //
  1524. // Paramters:
  1525. //  pTexture, pCubeTexture, pVolumeTexture
  1526. //      Pointer to the texture to be filled.
  1527. //  pFunction
  1528. //      Pointer to user provided evalutor function which will be used to 
  1529. //      compute the value of each texel.
  1530. //  pData
  1531. //      Pointer to an arbitrary block of user defined data.  This pointer 
  1532. //      will be passed to the function provided in pFunction
  1533. //-----------------------------------------------------------------------------
  1534.  
  1535. HRESULT WINAPI
  1536.     D3DXFillTexture(
  1537.         LPDIRECT3DTEXTURE8        pTexture,
  1538.         LPD3DXFILL2D              pFunction,
  1539.         LPVOID                    pData);
  1540.  
  1541. HRESULT WINAPI
  1542.     D3DXFillCubeTexture(
  1543.         LPDIRECT3DCUBETEXTURE8    pCubeTexture,
  1544.         LPD3DXFILL3D              pFunction,
  1545.         LPVOID                    pData);
  1546.  
  1547. HRESULT WINAPI
  1548.     D3DXFillVolumeTexture(
  1549.         LPDIRECT3DVOLUMETEXTURE8  pVolumeTexture,
  1550.         LPD3DXFILL3D              pFunction,
  1551.         LPVOID                    pData);
  1552.  
  1553.  
  1554.  
  1555. //----------------------------------------------------------------------------
  1556. // D3DXComputeNormalMap:
  1557. // ---------------------
  1558. // Converts a height map into a normal map.  The (x,y,z) components of each
  1559. // normal are mapped to the (r,g,b) channels of the output texture.
  1560. //
  1561. // Parameters
  1562. //  pTexture
  1563. //      Pointer to the destination texture
  1564. //  pSrcTexture
  1565. //      Pointer to the source heightmap texture 
  1566. //  pSrcPalette
  1567. //      Source palette of 256 colors, or NULL
  1568. //  Flags
  1569. //      D3DX_NORMALMAP flags
  1570. //  Channel
  1571. //      D3DX_CHANNEL specifying source of height information
  1572. //  Amplitude
  1573. //      The constant value which the height information is multiplied by.
  1574. //---------------------------------------------------------------------------
  1575.  
  1576. HRESULT WINAPI
  1577.     D3DXComputeNormalMap(
  1578.         LPDIRECT3DTEXTURE8        pTexture,
  1579.         LPDIRECT3DTEXTURE8        pSrcTexture,
  1580.         CONST PALETTEENTRY*       pSrcPalette,
  1581.         DWORD                     Flags,
  1582.         DWORD                     Channel,
  1583.         FLOAT                     Amplitude);
  1584.  
  1585.  
  1586.  
  1587.  
  1588. #ifdef __cplusplus
  1589. }
  1590. #endif //__cplusplus
  1591.  
  1592. #endif //__D3DX8TEX_H__
  1593.